package IOStreamStudy.bufferCopy;

import java.io.*;

/**
 *  buffered复制
 * */
public class BufferCopyDemo {
    public static void main(String[] args)  throws IOException {
        String readFile = "D:\\all_projects\\java_projects\\java_ij\\springMVC\\NetWork\\src\\cn\\usts\\edu\\IOStreamStudy\\bufferCopy\\read.txt";
        String writeFile = "D:\\all_projects\\java_projects\\java_ij\\springMVC\\NetWork\\src\\cn\\usts\\edu\\IOStreamStudy\\bufferCopy\\copy.txt";


        FileReader fileReader = new FileReader(readFile);
        FileWriter fileWriter = new FileWriter(writeFile);
        BufferedReader bufferedReader = new BufferedReader(fileReader);
        BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
        String line;
        int lineNum = 1;
        while ((line = bufferedReader.readLine())!=null){
            bufferedWriter.write(lineNum+":");
            bufferedWriter.write(line);
            bufferedWriter.newLine();
            lineNum++;
        }
        bufferedWriter.close();
        bufferedReader.close();
    }
}
